package com.xiaoke.domain.dto;

import com.xiaoke.annotation.CategoryExist;
import com.xiaoke.annotation.TagExist;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.*;
import java.util.Set;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CreateArticleDTO {
    @NotBlank(message = "标题不能为空")
    String title;
    @NotBlank(message = "内容不能为空")
    String content;
    String digest;
    @CategoryExist
    @NotNull(message = "分类ID不能为空")
    Integer categoryid;
    // 标签ID列表
    @TagExist
    Set<Long> tagIdList;
    @Max(value = 1,message = "状态值只能是0或1")
    @Min(value = 0,message = "状态值只能是0或1")
    // 状态
    Integer status = 1;
    @Max(value = 1,message = "置顶值只能是0或1")
    @Min(value = 0,message = "置顶值只能是0或1")
    // 是否置顶
    Integer isTop = 0;
}
